﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using SurveySystem.Core;

namespace SurveySystem.Web
{
    public static class WebUtils
    {
        public static Control FindControlRecursive(Control root, string id)
        {
            if (root.ID == id)
                return root;

            foreach (Control c in root.Controls)
            {
                Control found = FindControlRecursive(c, id);
                if (found != null)
                    return found;

            }

            return null;
        }

        public static string GetRoleString(GroupMemberRole role)
        {
            switch (role)
            {
                case GroupMemberRole.Admin:
                    return "Adminisztrátor";
                case GroupMemberRole.Owner:
                    return "Tulajdonos";
                case GroupMemberRole.Member:
                    return "Tag";
                case GroupMemberRole.Requesting:
                    return "Csatlakozás kérvényezve";
                case GroupMemberRole.NotMember:
                    return "Nem vagy tag";
                default:
                    return null;
            }
        }
    }
}
